package com.code.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.code.domain.LoginLog;
import com.code.mapper.LoginLogMapper;
import com.code.service.LoginLogService;
@Service
@Slf4j
public class LoginLogServiceImpl extends ServiceImpl<LoginLogMapper, LoginLog> implements LoginLogService{

    @Autowired
    private LoginLogMapper loginLogMapper;
    /**
     * 记录日志
     * curd
     * 增删改 要打印日志
     * 查询 也建议打印日志
     * ELK
     * @param type
     * @param username
     */
    @Override
    public void addLog(Integer type, String username) {
        log.info("记录用户的登录日志，用户为{}",username);
        LoginLog loginLog = LoginLog.builder().createTime(new Date()).type("密码登录").username(username).status(type).build();
    }
}
